t = input()
t=int(t)
for i in range(t):
    a=input()
    a=int(a)
    b=input()
    b=int(b)
    c=input()
    c=int(c)
    print(a^b^c)
